package com.ncs.cns.framework.widget.button;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.widget.TextView;

import com.ncs.cns.R;

public class TextButton extends TextView {
	private boolean click = false;

	public TextButton(Context context) {
		super(context);
		
	}
	
	public TextButton(Context context,AttributeSet attrs,int defStyle) {
		super(context, attrs, defStyle);
	
	}
	
	public TextButton(final Context context,AttributeSet attrs) {
		super(context, attrs, 0);
		this.setOnTouchListener(new OnTouchListener() {			
			@Override
			public boolean onTouch(View v, MotionEvent event) {
				if(click){
					v.setBackgroundResource(R.drawable.text_button_up);
					click = false;
				}else{
					v.setBackgroundResource(R.drawable.text_button_down);
					click = true;
				}
				return false;				
			}
		});
	}
}
